﻿using System;

class ReverseTheDigit

            // Write a method that reverses the digits of given decimal number. Example: 256  652

{
    static void Main()
    {
        Console.Write("Enter the number to be reversed: ");
        string decNumber = Console.ReadLine();
        char[] array = decNumber.ToCharArray();
        Console.WriteLine();

        ReversingTheDigits(array);
    }

    static void ReversingTheDigits(char[] array)
    {
        if (array[0] == '-')
        {
            array[0] = ' ';
        }

        Array.Reverse(array);
        string reversedNum = String.Join("", array);
        decimal result = decimal.Parse(reversedNum);
        Console.WriteLine("When the digits of the number are reversed we get: {0}", result);
    }
}

